﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OUnsuitableProdEdit.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.MacModel.OUnsuitableProdEdit" %>

 <style type="text/css">
        .OUnsuitableProdTable{ width:98%; border:2px solid #000; font-size:12px;  border-collapse:collapse;}
        .OUnsuitableProdTable td{ padding:2px; line-height:20px;border:1px dotted #000;}
        .OUnsuitableProdTable td.bold{ font-weight:bold;}
        .OUnsuitableProdTable tr.borderbottom td,.OUnsuitableProdTable td.borderbottom{ border-bottom:1px solid #000!important;}
        .OUnsuitableProdTable td.borderleft{border-left:1px solid #000!important;}
        .OUnsuitableProdTable input{width:98%; border-width:0px; border-bottom:1px solid #000; height:15px; line-height:15px; padding:2px; margin:0px; }
        .OUnsuitableProdTable textarea{width:98%; border:1px solid #000; padding:0px; margin:0px; }
    </style>
<div class="pageContent" style="">
 <form id="Form1" action="MacModel/OUnsuitableProdEdit.aspx?ajaxmethod=edit&UnsuitabledID=<%=UnsuitabledID %>&AddType=<%=AddType %>" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);">
                
 <div class="pageFormContent" layoutH="56"> 
           
    <table class="OUnsuitableProdTable" >
        <tr>
           <td colspan="4" style=" text-align:center; font-size:18px; font-weight:bold;">
               不适合品处理票
            </td>
            <td style="font-size:9px; background-color:#ccc;">导出文件简称：</td>
            <td colspan="3" style="font-size:9px; background-color:#ccc;">
                <input name="ExportFileName" class="text required" type="text" value="<%=obj.ExportFileName %>"/>
            </td>
        </tr>
        <tr>
            <td style="width:60px">机种:</td>
            <td style="width:100px;"><input name="MacType" class="text" type="text" value="<%=obj.MacType %>" /></td>
            <td style="width:70px">机器编号:</td>
            <td style="width:90px"><input name="SerialNumber" class="text" type="text"  value="<%=obj.SerialNumber %>"/></td>
            <td style="width:70px">发行日期:</td>
            <td style="width:120px"><input name="IssueDate" class="text date" type="text" value="<%=obj.IssueDate.ToString("yyyy-MM-dd") %>"/></td>
            <td style="width:70px">票号(NO.):</td>
            <td><input name="StampNo" class="text" type="text" value="<%=obj.StampNo %>"/></td>
        </tr>
        <tr>
            <td> 图号:</td>
            <td colspan="3"><input name="ItemCode" class="text" type="text" value="<%=obj.ItemCode %>"/></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td rowspan="6" class="borderbottom">编制:</td>
            <td rowspan="6" class="borderbottom"><input name="Worker"  type="text" value="<%=obj.Worker %>"/></td>
        </tr>
        <tr>
            <td>名称:</td>
            <td colspan="3"><input name="ItemName" class="text" type="text" value="<%=obj.ItemName %>"/></td>
            <td>数量:</td>
            <td><input name="Quantity" class="text number" type="text" value="<%=obj.Quantity %>"/></td>
        </tr>
        <tr>
            <td>供应商:</td>
            <td colspan="3"><input name="SupplerName" class="text autocomplete" type="text" value="<%=obj.SupplerName %>" readonly autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300"/></td>
            <td>重复发生:</td>
            <td><input name="IsMultiplicity" type="checkbox" value="true" <%=obj.IsMultiplicity?"checked":"" %>/></td>
        </tr>
        <tr>
            <td>零件号:</td>
            <td colspan="3"><input name="PartNum" class="text" type="text"  value="<%=obj.PartNum %>"/></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>发现场所:</td>
            <td>生产车间 </td>
            <td><input name="FindPrdWorkShop" type="checkbox" value="true" <%=obj.FindPrdWorkShop?"checked":"" %>/></td>
            <td>仓库</td>
            <td><input name="FindWarehouse" type="checkbox" value="true" <%=obj.FindWarehouse?"checked":"" %>/></td>
            <td>&nbsp;</td>
        </tr>
        <tr class="borderbottom">
            <td>ERP</td>
            <td>已入库</td>
            <td><input name="ERPFinished" type="checkbox" value="true" <%=obj.ERPFinished?"checked":"" %>/></td>
            <td>未入库</td>
            <td><input name="ERPNotFinished" type="checkbox" value="true" <%=obj.ERPNotFinished?"checked":"" %>/></td>
            <td> &nbsp;</td>
        </tr>
        <tr>
            <td colspan="4" class="bold">不适合现象描述:</td>
            <td colspan="4" class="bold borderleft" >图片说明:</td>
        </tr>
        <tr>
            <td colspan="4">
                <textarea name="UnsuitableDescribe" style="height:45px;"><%=obj.UnsuitableDescribe%></textarea>
            </td>
            <td rowspan="7" class="borderleft" colspan="4" style="padding:0px!important; margin:0px!important;">
                <table class="OUnsuitableProdTable" style=" border-width:0px!important;">
                    
                   <asp:repeater id="rpImg" runat="server">
                    <HeaderTemplate>
                    </HeaderTemplate>
                    <ItemTemplate>
                          <tr>
                                <td rowspan="2" style="width:70px"><IMG width="70px" height="45px" src="<%# Eval("IMGRelatively") %>" /></td>
                                <td style="width:120px">上传图片:</td>
                                <td>
                                    <input name="filedata" type="file" id="editOUnsuitableProdUpLoad<%# Eval("UnImgID") %>"  uploadify="uploadify" onUploadSuccess="onEditOUnsuitableProdUpLoadUploadSuccess" fileTypeDesc= 'Image Files' fileTypeExts= '*.gif; *.jpg; *.png,*.bmp,*jpeg'/>
                                    <input name="IMGAbsolutePath" type="hidden" value="<%# Eval("IMGAbsolutePath") %>" />
                                    <input name="IMGRelatively" type="hidden" value="<%# Eval("IMGRelatively") %>"/>
                                </td>
                            </tr>
                            <tr>
                                <td>图片<%# Eval("ShowIndex")%>说明:</td>
                                <td><input name="Title" type="text" value="<%# Eval("Title") %>"/></td>
                            </tr>
                    </ItemTemplate>
                    </asp:repeater>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="4" class="bold">原因分析(零件品质状况,确认结果):</td>
        </tr>
        <tr>
            <td colspan="4">
                <textarea name="AnalysisCause"  style="height:70px;"><%=obj.AnalysisCause%></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="4" class="bold">对策措施(临时对策及永久对策):</td>
        </tr>
        <tr>
            <td colspan="4">
                <textarea name="Countermeasure"  style="height:45px;"><%=obj.Countermeasure%></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="4" class="bold">效果确认(供应商回复):</td>
        </tr>
        <tr>
            <td colspan="4" rowspan="2">
                <textarea name="Verification"  style="height:45px;"><%=obj.Verification%></textarea>    
            </td>
        </tr>
        </table>
    <table class="OUnsuitableProdTable">
        <tr>
            <td>&nbsp;</td>
            <td style="width:55px" rowspan="2">质管部门<br/>处理意见</td>
            <td style="width:55px">退货返修</td>
            <td style="width:30px"><input name="NotionReturn" type="checkbox" value="true" <%=obj.NotionReturn?"checked":"" %>/></td>
            <td style="width:55px">厂内翻修</td>
            <td style="width:30px"><input name="NotionOverhaul" type="checkbox" value="true" <%=obj.NotionOverhaul?"checked":"" %>/></td>
            <td style="width:55px">特殊采用</td>
            <td style="width:30px"><input name="NotionSpecial" type="checkbox" value="true" <%=obj.NotionSpecial?"checked":"" %>/></td>
            <td style="width:30px">报废</td>
            <td style="width:30px"><input name="NotionScrap" type="checkbox" value="true" <%=obj.NotionScrap?"checked":"" %>/></td>
            <td style="width:40px" rowspan="2"><label ><input name="NotionEnter" type="checkbox" value="true" style=" width:30px!important;" <%=obj.NotionEnter?"checked":"" %>/>有无附属件</label></td>
            <td style="width:40px" rowspan="2"><label ><input name="NotionCanRepair" type="checkbox" value="true" style=" width:30px!important;" <%=obj.NotionEnter?"checked":"" %>/>能否返回维修</label></td>
            <td style="width:105px">防止再发对策书</td>
            <td style="width:20px">要</td>
            <td style="width:20px"><input name="NotionBookYes" type="checkbox" value="true" <%=obj.NotionBookYes?"checked":"" %>/></td>
            <td style="width:20px">否</td>
            <td><input name="NotionBookNo" type="checkbox" value="true" <%=obj.NotionBookNo?"checked":"" %>  style=" width:30px!important;" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>数量</td>
            <td><input name="NotionReturnNum" type="text"  value="<%=obj.NotionReturnNum%>"/></td>
            <td>数量</td>
            <td><input name="NotionOverhaulNum" type="text" value="<%=obj.NotionOverhaulNum%>"/></td>
            <td>数量</td>
            <td><input name="NotionSpecialNum" type="text" value="<%=obj.NotionSpecialNum%>"/></td>
            <td>数量</td>
            <td><input name="NotionScrapNum" type="text" value="<%=obj.NotionScrapNum%>"/></td>
          
            <td>要求回答日期</td>
            <td colspan="4"><input name="AnswerDate"  type="text" value="<%=obj.AnswerDate%>"/></td>
        </tr>
        <tr>
            <td rowspan="5" style=" text-align:center;width:20px;">
            损失费用
            </td>
            <td >调查费用</td>
            <td><input name="LoseSurveyUnit" id="OUPE_LoseSurveyUnit" type="text" value="<%=obj.LoseSurveyUnit%>" /></td>
            <td>Hｒ×</td>
            <td colspan="2"><input name="LoseSurveyPrice" id="OUPE_LoseSurveyPrice" type="text" value="<%=obj.LoseSurveyPrice%>" /></td>
            <td>元=</td>
            <td colspan="2"><input name="LoseSurveySubtotal" id="OUPE_LoseSurveySubtotal" type="text" value="<%=obj.LoseSurveySubtotal%>" /></td>
            <td>元</td>
            <td colspan="2">补偿金额合计</td>
            <td>供应商认可</td>
            <td colspan="4">责任判定</td>
        </tr>
        <tr>
            <td><input name="LoseModifyTitle" type="text" value="<%=obj.LoseModifyTitle%>" /></td>
            <td><input name="LoseModifyUnit" id="OUPE_LoseModifyUnit" type="text" value="<%=obj.LoseModifyUnit%>"/></td>
            <td>Hｒ×</td>
            <td colspan="2"><input name="LoseModifyPrice" id="OUPE_LoseModifyPrice" type="text" value="<%=obj.LoseModifyPrice%>" /></td>
            <td>元=</td>
            <td colspan="2"><input name="LoseModifySubtotal"  id="OUPE_LoseModifySubtotal" type="text" value="<%=obj.LoseModifySubtotal%>" /></td>
            <td>元</td>
            <td colspan="2" rowspan="2"><input name="LoseTotal" id="OUPE_LoseTotal" type="text" value="<%=obj.LoseTotal%>" /></td>
            <td rowspan="3"><input name="LoseSuppler" type="text" value="<%=obj.LoseSuppler%>" /></td>
            <td colspan="4" rowspan="3"><input name="LoseCtrDpt" type="text" value="<%=obj.LoseCtrDpt%>" /></td>
        </tr>
        <tr>
            <td>材料费</td>
            <td colspan="7"><input name="LoseMaterialsTotal" id="OUPE_LoseMaterialsTotal" type="text" value="<%=obj.LoseMaterialsTotal%>" /></td>
            <td>元</td>
        </tr>
        <tr>
             <td>保存费</td>
            <td><input name="LoseSaveUnit" type="text"  id="OUPE_LoseSaveUnit"  value="<%=obj.LoseSaveUnit%>" /></td>
            <td>天 ×</td>
            <td colspan="2"><input name="LoseSavePrice" id="OUPE_LoseSavePrice" type="text" value="<%=obj.LoseSavePrice%>" /></td>
            <td>元=</td>
            <td colspan="2"><input name="LoseSaveSubtotal" id="OUPE_LoseSaveSubtotal"  type="text" value="<%=obj.LoseSaveSubtotal%>"/></td>
            <td>元</td>

            <td colspan="2">(不含税)</td>
        </tr>
        <tr>           
            <td>其它费用</td>
            <td colspan="7"><input name="LoseDelaySubtotal" id="OUPE_LoseDelaySubtotal" type="text" value="<%=obj.LoseDelaySubtotal%>"/></td>
            <%--<td>Hｒ×</td>
            <td colspan="2"><input name="LoseDelayPrice" id="OUPE_LoseDelayPrice" type="text" value="<%=obj.LoseDelayPrice%>" /></td>
            <td>元=</td>
            <td colspan="2"><input name="LoseDelaySubtotal" id="OUPE_LoseDelaySubtotal"  type="text" value="<%=obj.LoseDelaySubtotal%>" /></td>--%>
            <td>元</td>
            <td colspan="7">提醒：对无对策又重复发生不良事项将严格追回所有损失</td>
        </tr>
        <tr>
            <td colspan="17">提醒：不良品限时退回，外地供应商限时3个月，本地供应商限时1个月，超时，将按到付的方式寄回供应商处或自行处理</td>
        </tr>
    </table>
    <hr style="width:100%; border:1px dotted #000; " />
     <div>
        注：必需填写物料号才会被记录系统。
    </div>
    <table class="OUnsuitableProdTable OUPT_ADD_TABLE_DETAIL">
        <tr>
            <td colspan="10" style=" text-align:center; font-weight:bold; font-size:14px;">不良品返回原材料入库单</td>
        </tr>
        <asp:repeater id="rpDetail1" runat="server">
            <ItemTemplate>
                <tr>
                    <td style="width:80px">
                        物料号:
                        <input name="DetailType" type="hidden" value="返回"/>
                    </td>
                    <td style="width:100px"><input name="DItemCode" type="text" value="<%# Eval("DItemCode") %>" toShowId="DItemCode<%# Eval("ShowIndex") %>" /></td>
                    <td style="width:80px">名称:</td>
                    <td style="width:100px"><input name="DItemName" type="text" value="<%# Eval("DItemName") %>"  toShowId="DItemName<%# Eval("ShowIndex") %>"/></td>
                    <td style="width:80px">数量:</td>
                    <td style="width:100px"><input name="DQuantity" class="number" type="text" value="<%# Eval("DQuantity") %>"  toShowId="DQuantity<%# Eval("ShowIndex") %>"/></td>
                    <td style="width:80px">退货返修:</td>
                    <td style="width:100px">
                        <input name="IsReturned" type="hidden" value="<%# Eval("IsReturned") %>"/>
                        <input type="checkbox" class="checkbox" forcheck="IsReturned"  <%# Convert.ToBoolean( Eval("IsReturned"))?"checked":"" %>/>
                        <input name="IsDefectivePrd" type="hidden" value="false" />
                    </td>
                    <td style="width:80px">报废处理:</td>
                    <td>
                         <input name="IsScrap" type="hidden" value="<%# Eval("IsScrap") %>"/>
                         <input type="checkbox" class="checkbox"  forcheck="IsScrap"  <%# Convert.ToBoolean( Eval("IsScrap"))?"checked":"" %>/>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:repeater>
    </table>

    <hr style="width:100%; border:1px dotted #000; " />
    <div>
        注：必需填写物料号才会被记录系统。
    </div>

    <table class="OUnsuitableProdTable">
        <tr>
            <td colspan="11" style=" text-align:center; font-weight:bold; font-size:14px;">不良品/报废原材料出库单</td>
        </tr>
         <asp:repeater id="rpDetail2" runat="server">
            <ItemTemplate>
                <tr>
                    <td  style="width:80px">
                    物料号:
                    <input name="DetailType" type="hidden" value="报废"/>
                    </td>
                    <td  style="width:100px"><input name="DItemCode" type="text"  value="<%# Eval("DItemCode") %>" id="DItemCode<%# Eval("ShowIndex") %>" /></td>
                    <td  style="width:80px">名称:</td>
                    <td style="width:100px"><input name="DItemName" type="text"  value="<%# Eval("DItemName") %>"  id="DItemName<%# Eval("ShowIndex") %>"/></td>
                    <td  style="width:80px">数量:</td>
                    <td style="width:100px"><input name="DQuantity" class="number" type="text"  value="<%# Eval("DQuantity") %>" id="DQuantity<%# Eval("ShowIndex") %>"/></td>
                    <td  style="width:80px">不良品转库:</td>
                    <td style="width:100px">
                        <input name="IsReturned" type="hidden" value="false" />
                        <input name="IsDefectivePrd" type="hidden"  value="<%# Eval("IsDefectivePrd") %>"/>
                        <input type="checkbox"  class="checkbox" forcheck="IsDefectivePrd" <%# Convert.ToBoolean( Eval("IsDefectivePrd"))?"checked":"" %>/>
                    </td>
                    <td  style="width:80px">报废处理:</td>
                    <td>
                        <input name="IsScrap" type="hidden" value="<%# Eval("IsScrap") %>" />
                        <input type="checkbox" class="checkbox" forcheck="IsScrap" <%# Convert.ToBoolean( Eval("IsScrap"))?"checked":"" %>/>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:repeater>
       
    </table>
    <script type="text/javascript">

        function onEditOUnsuitableProdUpLoadUploadSuccess(file, data, response) {
                if (!response)
                    return false;
                data = eval("(" + data + ")");
                if (!data.uploadResult) {
                    alert(data.errMsg);
                    return;
                }
                var $imgUploadPath = data.filePath;
                var $trageId = data.customerInfo;

                var $IMGAbsolutePath = $("#" + $trageId).closest("td").find(":hidden[name='IMGAbsolutePath']"); //图片实际路际
                var $IMGRelatively = $("#" + $trageId).closest("td").find(":hidden[name='IMGRelatively']"); //图片相对路际
                var $img = $("#" + $trageId).closest("tr").find("IMG");
                $img.attr("src", $imgUploadPath);
                $IMGAbsolutePath.val("E:/WEB/IHISCE" + $imgUploadPath);
                $IMGRelatively.val($imgUploadPath);
            }

        $(function () {
          

            $(".OUnsuitableProdTable").find(".checkbox").change(function () {
                $ck = $(this).closest("td").find(":hidden[name='" + $(this).attr("forcheck") + "']");
                // alert($(this).attr("forcheck"));
                //alert($(this).attr("checked"));
                $ck.val($(this).attr("checked"));
            })
            //金额自动统计
            //调查费用
            $("#OUPE_LoseSurveyUnit,#OUPE_LoseSurveyPrice").change(function () {
                var $LoseSurveyUnit = parseFloat($("#OUPE_LoseSurveyUnit").val());
                var $LoseSurveyPrice = parseFloat($("#OUPE_LoseSurveyPrice").val());
                $("#OUPE_LoseSurveySubtotal").val($LoseSurveyUnit * $LoseSurveyPrice);
                changeLoseTotal();
            })
            //修正费用
            $("#OUPE_LoseModifyUnit,#OUPE_LoseModifyPrice").change(function () {
                var $LoseModifyUnit = parseFloat($("#OUPE_LoseModifyUnit").val());
                var $LoseModifyPrice = parseFloat($("#OUPE_LoseModifyPrice").val());
                $("#OUPE_LoseModifySubtotal").val($LoseModifyUnit * $LoseModifyPrice);
                changeLoseTotal();
            });
            //材料费 ，其它费用
            $("#OUPE_LoseSurveySubtotal,#OUPE_LoseModifySubtotal,#OUPE_LoseSaveSubtotal,#OUPE_LoseMaterialsTotal,#OUPE_LoseDelaySubtotal").change(function () {
                changeLoseTotal();
            })
//            //延误费用
//            $("#OUPE_LoseDelayUnit,#OUPE_LoseDelayPrice").change(function () {
//                var $LoseDelayUnit = parseFloat($("#OUPE_LoseDelayUnit").val());
//                var $LoseDelayPrice = parseFloat($("#OUPE_LoseDelayPrice").val());
//                $("#OUPE_LoseDelaySubtotal").val($LoseDelayUnit * $LoseDelayPrice);
//                changeLoseTotal();
//            });
            //保存费
            $("#OUPE_LoseSaveUnit,#OUPE_LoseSavePrice").change(function () {
                var $LoseSaveUnit = parseFloat($("#OUPE_LoseSaveUnit").val());
                var $LoseSavePrice = parseFloat($("#OUPE_LoseSavePrice").val());
                $("#OUPE_LoseSaveSubtotal").val($LoseSaveUnit * $LoseSavePrice);
                changeLoseTotal();
            })

            $("table.OUPT_ADD_TABLE_DETAIL").find(":text").change(function () {
                var $showid = $(this).attr("toShowId");
                $("#" + $showid).val($(this).val());
            })
        });

        function changeLoseTotal() {
//            var $LoseTotal = parseFloat($("#OUPE_LoseSurveySubtotal").val()) + parseFloat($("#OUPE_LoseModifySubtotal").val()) + parseFloat($("#OUPE_LoseMaterialsTotal").val()) + parseFloat($("#OUPE_LoseDelaySubtotal").val()) + parseFloat($("#OUPE_LoseSaveSubtotal").val());
            //            $("#OUPE_LoseTotal").val($LoseTotal);
            var $LoseTotal = parseFloat($("#OUPE_LoseSurveySubtotal").val()) + parseFloat($("#OUPE_LoseModifySubtotal").val()) + parseFloat($("#OUPE_LoseSaveSubtotal").val());

            parseFloat($("#OUPE_LoseMaterialsTotal").val()) + parseFloat($("#OUPE_LoseDelaySubtotal").val())
            var $temp = parseFloat($("#OUPE_LoseMaterialsTotal").val())
            if (isNaN($temp))
                $temp = 0
            $LoseTotal = $LoseTotal + $temp;

            $temp = parseFloat($("#OUPE_LoseDelaySubtotal").val())
            if (isNaN($temp))
                $temp = 0
            $LoseTotal = $LoseTotal + $temp;

            $("#OUPE_LoseTotal").val($LoseTotal);
        }
    </script>
</div>
<div class="formBar">
   <ul>
				<li><div class="buttonActive"><div class="buttonContent">                 
                    <button type="submit"><%=AddType == 0 ? "修改" : "补充及追加"%></button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
       
</form>
</div> 
